#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
财联社电报采集系统使用演示
"""

from collector import CailianPressCollector
from models import TelegramDatabase


def demo():
    print("=== 财联社电报采集系统演示 ===\n")
    
    # 创建采集器实例
    collector = CailianPressCollector()
    
    # 1. 采集数据
    print("1. 正在采集财联社电报数据...")
    count = collector.collect_and_save()
    print(f"   本次采集新增 {count} 条电报数据\n")
    
    # 2. 显示统计数据
    db = TelegramDatabase()
    total = db.get_telegram_count()
    print(f"2. 数据库统计:")
    print(f"   总电报数: {total} 条\n")
    
    # 3. 显示最新电报
    print("3. 最新电报预览:")
    collector.display_latest_telegrams(3)
    
    print("\n=== 演示完成 ===")


if __name__ == "__main__":
    demo()